package com.mingdao.lhy.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mingdao.lhy.mapper.signup.SignUpStudentMapper2;
import com.mingdao.lhy.mapper.wish.ArtSpecialtySignUpMapper;
import com.mingdao.lhy.mapper.wish.MiddleSchoolMapper;
import com.mingdao.lhy.mapper.wish.SignUpStudentMapper;
import com.mingdao.lhy.mapper.wish.ZkwMapper;
import com.mingdao.lhy.pojo.SignUpStudent;
import com.mingdao.lhy.pojo.Zkw;
import com.mingdao.lhy.pojo.page.ArtSpecialtySignUp;
import com.mingdao.lhy.pojo.signup.SignUpStudent2;

@Service
public class CityServiceImpl implements CityService {

	private static Logger log = LoggerFactory.getLogger(CityServiceImpl.class);

	@Autowired
	private ZkwMapper zkwMapper;

	@Autowired
	private SignUpStudentMapper signUpStudentMapper;

	@Autowired
	private SignUpStudentMapper2 signUpStudentMapper2;

	@Autowired
	private MiddleSchoolMapper middleSchoolMapper;

	@Autowired
	private ArtSpecialtySignUpMapper artSpecialtySignUpMapper;

	/**
	 * 根据学校代码返回学校信息
	 */
	@Override
	public Zkw getZkwById(String userid) {
		Zkw zkw = zkwMapper.getOne(userid);
		return zkw;
	}

	@Override
	public int changePassword(Zkw zkw) {
		int result = zkwMapper.updatePasswordByPrimaryKey(zkw);
		return result;
	}

	@Override
	public List<SignUpStudent> getWishedStudentByXsdmWished(String xsdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		List<SignUpStudent> students = signUpStudentMapper.getWishedStudentByXsdmWished(map);
		return students;
	}

	@Override
	public List<SignUpStudent> getWishedStudentByXsdmNotWished(String xsdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		List<SignUpStudent> students = signUpStudentMapper.getWishedStudentByXsdmNotWished(map);
		return students;
	}

	@Override
	public List<SignUpStudent> getWishedStudentByXsdmWishedMiddle(String xsdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		List<SignUpStudent> students = signUpStudentMapper.getWishedStudentByXsdmWishedMiddle(map);
		return students;
	}

	@Override
	public List<SignUpStudent> getWishedStudentByXsdmNotWishedMiddle(String xsdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		List<SignUpStudent> students = signUpStudentMapper.getWishedStudentByXsdmNotWishedMiddle(map);
		return students;
	}

	@Override
	public List<ArtSpecialtySignUp> getWishedStudentByXsdmArtSpecialty(String xsdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		List<ArtSpecialtySignUp> students = artSpecialtySignUpMapper.getWishedStudentByXsdmArtSpecialty(map);
		return students;
	}

	@Override
	public List<ArtSpecialtySignUp> getWishedStudentByXsdmArtSpecialtyCityYt(String xqdm) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("xqdm", xqdm);
		List<ArtSpecialtySignUp> students = artSpecialtySignUpMapper.getWishedStudentByXsdmArtSpecialtyCity(map);
		return students;
	}

	@Override
	public List<ArtSpecialtySignUp> getWishedStudentByXsdmArtSpecialtyTs(String xsdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		List<ArtSpecialtySignUp> students = artSpecialtySignUpMapper.getWishedStudentByXsdmArtSpecialtyTs(map);
		return students;
	}

	@Override
	public List<ArtSpecialtySignUp> getWishedStudentByXsdmArtSpecialtyCityTs(String xqdm) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("xqdm", xqdm);
		List<ArtSpecialtySignUp> students = artSpecialtySignUpMapper.getWishedStudentByXsdmArtSpecialtyCityTs(map);
		return students;
	}

	@Override
	public List<ArtSpecialtySignUp> getArtSpecialtySignUpByXsdmYt(String xsdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xqdm", xsdm);
		List<ArtSpecialtySignUp> students = artSpecialtySignUpMapper.getWishedStudentByXsdmArtSpecialtyCity(map);
		return students;
	}

	@Override
	public List<ArtSpecialtySignUp> getArtSpecialtySignUpByXsdmTs(String xsdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xqdm", xsdm);
		List<ArtSpecialtySignUp> students = artSpecialtySignUpMapper.getWishedStudentByXsdmArtSpecialtyCityTs(map);
		return students;
	}

	@Override
	public int updateArtSpecialtyScoreYt(ArtSpecialtySignUp artSpecialtySignUp) {
		int result = -1;
		result = artSpecialtySignUpMapper.updateByPrimaryKeySelectiveYt(artSpecialtySignUp);
		return result;
	}

	@Override
	public int updateArtSpecialtyScoreTs(ArtSpecialtySignUp artSpecialtySignUp) {
		int result = -1;
		result = artSpecialtySignUpMapper.updateByPrimaryKeySelectiveTs(artSpecialtySignUp);
		return result;
	}

	@Override
	public int updateArtSpecialtyExamineByBmhYt(String bmh) {
		int result = artSpecialtySignUpMapper.updateArtSpecialtyExamineByBmhYt(bmh);
		return result;
	}

	@Override
	public int updateArtSpecialtyExamineByBmhTs(String bmh) {
		int result = artSpecialtySignUpMapper.updateArtSpecialtyExamineByBmhTs(bmh);
		return result;
	}

	@Override
	public int updateArtSpecialtyCancelExamineByBmhYt(String bmh) {
		int result = artSpecialtySignUpMapper.updateArtSpecialtyCancelExamineByBmhYt(bmh);
		return result;
	}

	@Override
	public int updateArtSpecialtyCancelExamineByBmhTs(String bmh) {
		int result = artSpecialtySignUpMapper.updateArtSpecialtyCancelExamineByBmhTs(bmh);
		return result;
	}

	@Override
	public List<SignUpStudent> getWishedStudentByXsdmWishedPage(String xsdm, String bmh, int pageSize, int pageIndex) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		map.put("pageSize", pageSize + "");
		map.put("pageIndex", pageIndex + "");
		List<SignUpStudent> students = signUpStudentMapper.getWishedStudentByXsdmWishedPage(map);
		return students;
	}

	@Override
	public List<SignUpStudent> getWishedStudentByXsdmNotWishedPage(String xsdm, String bmh, int pageSize,
			int pageIndex) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		map.put("pageSize", pageSize + "");
		map.put("pageIndex", pageIndex + "");
		List<SignUpStudent> students = signUpStudentMapper.getWishedStudentByXsdmNotWishedPage(map);
		return students;
	}

	@Override
	public List<SignUpStudent> getWishedStudentByXsdmWishedMiddlePage(String xsdm, String bmh, int pageSize,
			int pageIndex) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		map.put("pageSize", pageSize + "");
		map.put("pageIndex", pageIndex + "");
		List<SignUpStudent> students = signUpStudentMapper.getWishedStudentByXsdmWishedMiddlePage(map);
		return students;
	}

	@Override
	public List<SignUpStudent> getWishedStudentByXsdmNotWishedMiddlePage(String xsdm, String bmh, int pageSize,
			int pageIndex) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("bmh", bmh);
		map.put("xsdm", xsdm);
		map.put("pageSize", pageSize + "");
		map.put("pageIndex", pageIndex + "");
		List<SignUpStudent> students = signUpStudentMapper.getWishedStudentByXsdmNotWishedMiddlePage(map);
		return students;
	}

	@Override
	public int createBmhBatch(String byzxdm) {
		int result = signUpStudentMapper2.createBmhBatch(byzxdm);
		return result;
	}

	@Override
	public int createBmhBySfzh(SignUpStudent2 student2) {
		int result = signUpStudentMapper2.createBmhBySfzh(student2);
		return result;
	}

	@Override
	public List<SignUpStudent> getStudentByDclzt(String dclzt, String xsdm) {
		Map<String, String> param = new HashMap<String, String>();
		param.put("dclzt", dclzt);
		param.put("xsdm", xsdm);
		return signUpStudentMapper2.getStudentByDclzt(param);
	}

	@Override
	public List<SignUpStudent2> getStudentByDclztPage(String dclzt, String xsdm, String pageSize, String pageIndex,
			String sfzh) {
		Map<String, String> param = new HashMap<String, String>();
		param.put("dclzt", dclzt);
		param.put("xsdm", xsdm);
		param.put("pageSize", pageSize);
		param.put("pageIndex", pageIndex);
		param.put("sfzh", sfzh);
		return signUpStudentMapper2.getStudentByDclztPage(param);
	}

	@Override
	public List<SignUpStudent2> getWBMStudent(String xsdm, String pageSize, String pageIndex) {

		Map<String, String> param = new HashMap<String, String>();
		param.put("xsdm", xsdm);
		param.put("pageSize", pageSize);
		param.put("pageIndex", pageIndex);

		return signUpStudentMapper2.getWBMStudent(param);
	}

	@Override
	public int doSaveStudnet(SignUpStudent2 student) {
		// TODO Auto-generated method stub
		return signUpStudentMapper2.doSaveStudnet(student);
	}

}
